package com.hello.test.service.ServiceImpl;

import com.hello.test.dao.UserMapper;
import com.hello.test.model.User;
import com.hello.test.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService{
    @Autowired
    private UserMapper userMapper;
    @Override
    public int insertUser(User user) {
      int res = userMapper.insert(user);
      return res;
    }

    @Override
    public int updateUser(int id) {
        int delRes = userMapper.deleteByPrimaryKey(id);
        return delRes;
    }

    @Override
    public User queryUser(int openid) {
        userMapper.selectByPrimaryKey(openid);
        return null;
    }


    @Override
    public int deleteUser(String openid) {
        int res = userMapper.deleteByOpenId(openid);
        return res;
    }

    @Override
    public User selectByOpenId(String openId) {
        User user = userMapper.selectByOpenId(openId);
        return user;
    }
}
